package com.example.mywechatprogram.controller;

import com.example.mywechatprogram.entity.Rank;
import com.example.mywechatprogram.entity.Response;
import com.example.mywechatprogram.mapper.RankMapper;

import com.example.mywechatprogram.service.RankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.data.redis.core.RedisTemplate;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.concurrent.TimeUnit;


@RestController
public class RankController {
    @Autowired
    RankService rankService;

    @PostMapping("/Rank/add")
    public Response add(String nickname){
        return rankService.add(nickname);
    }
    @PostMapping("/Rank/update")
    public Response update(String nickname){
        return rankService.update(nickname);
    }
    @GetMapping("/Rank/queryToday")
    public Response queryToday(String nickname){
        return rankService.queryToday(nickname);
    }

    @GetMapping("/Rank/query")
    public Response query(int day){
        return rankService.query(day);
    }

    @GetMapping("/Rank/query7")
    public Response query7(){return rankService.queryTotalRank();}
}
